import { memo, useEffect, useMemo, useRef, useState } from 'react'
import * as echarts from 'echarts'
import classNames from 'classnames'
import { isObject } from '@multi-kit/inspect'
import { SwitchButton } from '@/components'

export interface Props {
  state: unknown
}

function Control<Props>(props: Props) {
  const { state } = props

  const stateMap = {
    0: '正常',
    1: '信号丢失',
    2: '数据错误',
    2: '电流保护'
  }
  return (
    <div className="grid grid-cols-2  ">
      <div className="p-2 text-center border border-slate-700 flex items-center justify-center">电机A</div>
      <div className="p-2 text-center border border-slate-700">
        {stateMap[state?.motorAControl] || stateMap[0]}
      </div>
      <div className="p-2 text-center border border-slate-700 flex items-center justify-center">电机B</div>
      <div className="p-2 text-center border border-slate-700">
      {stateMap[state?.motorBControl] || stateMap[0]}
      </div>
    </div>
  )
}

export default memo(Control)
